package com.xyc.divisor;

/**
 *Description:greatest common divisor
 *Author:yemoo 2006.12.07 */
class Divisor{
	 int divisor1(int m,int n){    //方法一：循环法
         int temp;
         while(m%n!=0){
             temp=n;
             n=m%n;
             m=temp;
         }
         return n;
     }

     int divisor2(int m,int n){    //方法二：递归法
         if(m%n==0){
            return n;
        }else{
            return divisor2(n,m%n);
        }
     }

}
 public class Pt32{
    //思路：辗转相除法


     public static void main(String args[]){
         int i,j;
         i=Integer.parseInt(args[0]);
         j=Integer.parseInt(args[1]);
         Divisor divis=new Divisor();
         System.out.println(i+","+j+"'s greatest common divisor is "+divis.divisor1(i,j));
     }

 }